<td class="actions"><table cellpadding="0" cellspacing="0">
  <tr>
    <td class="indicator-container">
      <%= loading_indicator_tag(:action => :record, :id => record.id) %>
    </td>
    <% active_scaffold_config.action_links.each :member do |link| -%>
      <% next if skip_action_link(link) or link.action == "delete" or link.action == "destroy" -%>
      <td>
        <%= if record.authorized_for?(:crud_type => link.crud_type, :action => link.action)
              if link.action == "edit" and (link.label == "Modifica")
                render_action_image_link("icons/wrench.png", link, url_options, record)
              elsif link.action == "show" and (link.label == "Mostra")
                render_action_image_link("icons/magnifier.png", link, url_options, record)
              elsif (link.action == "destroy" or link.action == "delete" or link.action == "destroy_existing") and (link.label == "Elimina")
                render_action_image_link("icons/delete.png", link, url_options, record)
              elsif link.action == "nested" and (link.label == "Note")
                if record.note.count > 0
                  render_action_image_link("icons/note.png", link, url_options, record)# + "<br>(#{record.note.count})"
                else
                  render_action_image_link("icons/note-disable.png", link, url_options, record)
                end
              elsif link.action == "nested" and (link.label == "Allegati")
                if record.allegati.count > 0
                  render_action_image_link("icons/attach.png", link, url_options, record)# + "<br>(#{record.allegati.count})"
                else
                  render_action_image_link("icons/attach-disable.png", link, url_options, record)
                end
              elsif link.action == "nested" and (link.label == "Versioni")
                render_action_image_link("icons/clock_go.png", link, url_options, record)
              elsif link.action == "nested" and (link.label == "Segnalazioni")
                if record.segnalazioni_differenziata.count > 0
                  render_action_image_link("icons/note.png", link, url_options, record)
                else
                  render_action_image_link("icons/note-disable.png", link, url_options, record)
                end
              elsif link.action == "mappa" and (link.label == "Mappa")
                render_action_image_link("icons/map.png", link, url_options, record)
              elsif link.action == "generate_odt"
                render_action_image_link("icons/page_white_word.png", link, url_options, record)
              else
                render_action_link(link, url_options, record)
              end
            elsif link.action == "delete"
                "<a class='disabled #{link.action}'><img border=0 src='#{url_prefix}/images/icons/delete-disabled.png' alt='Non eliminabile' title='Non eliminabile'></a>"
            else
              "<a class='disabled #{link.action}'>#{link.label}</a>" 
          end -%>
      </td>
    <% end -%>
  </tr>
</table>

<% target_id = element_row_id(:action => :list, :id => record.id) -%>
<script type="text/javascript">
//<![CDATA[
new ActiveScaffold.Actions.Record(
  $$('#<%= target_id -%> a.action'),
  $('<%= target_id -%>'),
  $('<%= loading_indicator_id(:action => :record, :id => record.id) -%>'),
  {refresh_url: '<%= url_for params_for(:action => :row, :id => record.id, :_method => :get, :escape => true) -%>'}
);
//]]>
</script>
</td>
